package com.slw.caiji.controller;

import com.slw.caiji.Vo.params.PageParams;
import com.slw.caiji.dto.SysApp;
import com.slw.caiji.service.SysAppService;
import com.slw.caiji.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/app")
@Api(tags = "应用管理")
public class SysAppController {

    @Autowired
    private SysAppService sysAppService;


    @PostMapping("list")
    @Operation(summary = "分页获取应用列表", description = "分页获取应用列表")
    public Result getList(@RequestBody PageParams pageParams) {
        return sysAppService.getSysAppList(pageParams);
    }

    @PostMapping("add")
    @Operation(summary = "新增应用", description = "新增应用")
    public Result addUser(@RequestBody SysApp sysApp) {
        return sysAppService.addApp(sysApp);
    }

    @GetMapping("del")
    @Operation(summary = "删除应用", description = "删除应用")
    public Result delUser(@RequestParam String ids) {
        return sysAppService.delApp(ids);
    }

    @GetMapping("detail")
    @Operation(summary = "应用详情接口", description = "获取应用详情")
    public Result detailUser(@RequestParam String id) {
        return sysAppService.detailApp(id);
    }

    @PostMapping("update")
    @Operation(summary = "更新应用接口", description = "编辑应用信息")
    public Result updateUser(@RequestBody SysApp sysApp) {
        return sysAppService.updateApp(sysApp);
    }


}
